#define _CRT_SECURE_NO_WARNINGS 1
#include"SList.h"

//void test1()
//{
//	SLTNode *node1 = (SLTNode*)malloc(sizeof(SLTNode));
//	node1->data = 1;
//	SLTNode *node2 = (SLTNode*)malloc(sizeof(SLTNode));
//	node2->data = 2;
//	SLTNode *node3 = (SLTNode*)malloc(sizeof(SLTNode));
//	node3->data = 3;
//	SLTNode *node4 = (SLTNode*)malloc(sizeof(SLTNode));
//	node4->data = 4;
//	SLTNode *node5 = (SLTNode*)malloc(sizeof(SLTNode));
//	node5->data = 5;
//
//	node1->next = node2;
//	node2->next = node3;
//	node3->next = node4;
//	node4->next = node5;
//	node5->next = NULL;
//	SLTNode* plist = node1;
//
//	SLTPrint(plist);
//
//}

void test2()
{
	SLTNode *node1 = (SLTNode*)malloc(sizeof(SLTNode));
	node1->data = 1;
	node1->next = NULL;
	SLTNode* plist =node1;
	SLTPushFront(&plist, 2);//2->1->NULL
	SLTPushBack(&plist, 3);//2->1->3->NULL;
	SLTPrint(plist);

	//SLTPopBack(&plist);//2->1->NULL
	//SLTPrint(plist);
	//SLTPopFront(&plist);//1->NULL
	//SLTPrint(plist);
	//SLTPopFront(&plist);//NULL
	
	//SLTNode* SLTRet1 = SLTFind(plist, 3);
	//SLTInsert(&plist, SLTRet1, 4);//2->1->4->3->NULL;
	//SLTPrint(plist);
	//SLTNode* SLTRet2 = SLTFind(plist, 2);
	//SLTInsertAfter(SLTRet2, 5);//2->5->1->4->3->NULL;

	SLTNode* SLTRet1 = SLTFind(plist, 1);
	SLTErase(&plist, SLTRet1);//2->3->NULL;
	SLTPrint(plist);
	SLTNode* SLTRet2 = SLTFind(plist, 2);
	SLTEraseAfter(SLTRet2);//2->NULL;
	SLTPrint(plist);

	SLTDesTroy(&plist);
}
int main()
{
	test2();
	return 0;
}

